package basic.JUC;

/**
 * @创建人 MBY381
 * @创建时间 2022/4/9 14:38
 * @描述 暂无
 */
public class FirstTrial {
    public static void main(String[] args) {
        System.out.println(Thread.currentThread().getName());

        Thread a = new myThread();
        System.out.println(Thread.currentThread().getName());//mythread main被改名了
        a.start();

        Thread run = new Thread(new myRunnable());
        run.start();
//        System.out.println(Thread.currentThread().getName());  wrong
    }

    public static void printThreadName() {
        System.out.print(Thread.currentThread().getName() + "  :");
    }

    public static void zax() {
        System.out.println("\n------------------------------------------------------------------------\n");
    }

    static class myThread extends Thread {
        myThread() {
            Thread.currentThread().setName("myThread" + Thread.currentThread().getId());
        }

        @Override
        public void run() {
            System.out.println("wdnmd");
            Thread.currentThread().setName("myThread" + Thread.currentThread().getId());
            System.out.println(Thread.currentThread().getName());
        }
    }

    static class myRunnable implements Runnable {
        @Override
        public void run() {

            System.out.println("RUNNABLE");
            System.out.println(Thread.currentThread().getName());
        }
    }
}
